# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-argcomplete
_pyname=argcomplete
pkgver=3.3.0
pkgrel=0
pkgdesc="Easy, extensible command line tab completion of arguments for your Python script"
url="https://github.com/kislyuk/argcomplete"
arch="noarch"
license="Apache-2.0"
makedepends="py3-setuptools py3-gpep517 py3-wheel py3-installer py3-setuptools_scm"
checkdepends="py3-pexpect bash fish tcsh"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/kislyuk/$_pyname/archive/v$pkgver.tar.gz
	disable-zsh-tests.patch
	skip-pip.patch
	"
builddir="$srcdir/$_pyname-$pkgver"
options="!check" # fail with ebadf on the builders for some reason

replaces="py-argcomplete" # Backwards compatibility
provides="py-argcomplete=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION="$pkgver"
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 test/test.py -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/argcomplete*.whl
	rm -rf "$pkgdir"/usr/lib/python3.11/site-packages/test/
}

sha512sums="
9b2e98e48aa082ae609e2b924c24e26892cac62652e885b30ded984e3399658b0099e0d7cca9957e47cb6c3cf31d936e9b088ffbd0be62d3ea58883f442e6bcd  py3-argcomplete-3.3.0.tar.gz
cc3aa820a255a6ccd9aee0f3a3bf369a93d3e01d80e3586ad839f45405907a64a74e485669f43811ae708d18047c8f8387fa7199d3e67b5c021df04cb10e9a91  disable-zsh-tests.patch
3c48d5c07619fe36cff9235864c5e7ef2f0703d39c66bb40d9149cd16b72dfcc978e70a95695dcbdfc241f8241f16d387e087f22e35bd180010126b9b8d738bd  skip-pip.patch
"
